Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | //页面错误处理 |
||
2 | module.exports = async function (ctx, next) { |
||
3 | await next() |
||
4 | if (parseInt(ctx.status) === 404) { |
||
5 | ctx.body = { |
||
6 | code: 404, |
||
7 | success: false, |
||
8 | data: [], |
||
9 | msg: '没有找到页面' |
||
10 | } |
||
11 | } |
||
12 | else if (parseInt(ctx.status) === 403) { |
||
13 | ctx.body = { |
||
14 | code: 403, |
||
15 | success: false, |
||
16 | data: [], |
||
17 | msg: '权限不足' |
||
18 | } |
||
19 | } |
||
20 | } |
||
21 | |||
22 |